package com.kingyun.gpsinspection.purificationservice.services.iam.innerservice.up.impl;

import com.kingyun.gpsinspection.purificationservice.dao.mapper.iam.up.MenuItemsMapper;
import com.kingyun.gpsinspection.purificationservice.facade.model.iam.up.MenuItems;
import com.kingyun.gpsinspection.purificationservice.facade.service.iam.up.MenuItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ${yangsy} on 2017/3/28.
 */
@Service
public class MenuItemsServiceImpl implements MenuItemsService {
    @Autowired
    private MenuItemsMapper menuItemsMapper;

    @Override
    public List<MenuItems> queryList(String userId) {
        return menuItemsMapper.queryList(userId);
    }

    @Override
    public List<MenuItems> queryList2(String userId) {
        //  根据用户角色，显示我的收藏
        List<MenuItems> menuItemsList = new ArrayList<>();
        MenuItems menuItems = new MenuItems();
        if (userId.equals("")) {
            //  角色1
            menuItems = new MenuItems();
            menuItems.setMenuName("菜单1");
            menuItems.setMenuUrl("");
            menuItemsList.add(menuItems);
        } else if (userId.equals("")) {
            //  角色2
            menuItems = new MenuItems();

        } else if (userId.equals("")) {
            //  角色3
            menuItems = new MenuItems();
        } else {
            menuItems = new MenuItems();
            //  其他
        }
        return menuItemsList;
    }

    @Override
    public MenuItems getMenuItems(String code) {
        return menuItemsMapper.getMenuItems(code);
    }
}
